


#delimit;
set more off;

cd "C:\....\Replication files";
	
use "ENMI - replication.dta", clear;


/**** combine the natural pairs	****/

gen i1= ((per102*total + per101*total)/total);
gen i2= ((per104*total + per105*total) / total);
gen i3= ((per109*total + per107*total)/total);
gen i4= ((per110*total + per108*total)/total);
gen i5= ((per204*total + per203*total)/total);
gen i6= ((per302*total + per301*total)/total);
gen i7= ((per406*total + per407*total)/total);
gen i8= ((per414*total + per409*total)/ total);
gen i9= ((per601*total + per602*total) /total);
gen i10= ((per603*total + per604*total) /total);
gen i11= ((per608*total + per607*total) /total);
gen i12= ((per702*total + per701*total) /total);
gen i13= ((per504*total + per505*total ) /total);
gen i14= ((per507*total + per506*total) /total); 
	
	gen econ_i= (per401*total + per402*total + per403*total +per404*total + per405*total
	+ per406*total + per407*total +
		per408*total + per409*total + per410*total + per411*total
		+ per412*total + per413*total + per414*total + per415*total + per416*total)/total;
	
 #delimit;
 set more off;
 
/* Generate a CMP measure collapsing all economic issues into one category*/

foreach i in i1 per103 i2 per106  i3 i4 per201 per202 i5 i6 per303 per304 per305 econ_i per501 per502 per503 i13 i14 
	i9 i10 per605 per606 i11 i12 per703 per704 per705 per706 {;

gen sh_`i'= `i'*ln(`i'); 	
			replace sh_`i'=0 if `i'==0;

};
 egen ensh_1econ= rowtotal(sh_*);
 replace ensh_1econ= -1*ensh_1econ;

corr ensh_1econ ensh_mi;

set more off;
xtreg pvote
	c.ensh_1econ##1.inc_cab_l
	pvote_l ,
 fe robust;


xtreg pvote
	c.ensh_1econ##1.inc_cab_l 
	
	pvote_l
	c.GDPgrowth##1.inc_cab_l
	c.moderate##1.inc_cab_l

	1.nparty
 majelect federal directpres ,
 fe robust;

estimates store ENMI_1econ_full;	

		 xtreg pvote
	c.ensh_1econ  
	pvote_l
	c.GDPgrowth
	c.moderate

	1.nparty
 majelect federal directpres if inc_cab_l==0,
 fe robust;
		
		 estimates store ENMI_1econ_opp;	
	
	
	xtreg pvote
	c.ensh_1econ#1.inc_cab_l 
	pvote_l
	c.GDPgrowth#1.inc_cab_l
	c.moderate#1.inc_cab_l

	1.nparty
 majelect federal directpres if inc_cab_l==1,
 fe robust;
		 estimates store ENMI_1econ_inc;
	



	 #delimit;
 esttab  ENMI_1econ_opp ENMI_1econ_inc ENMI_1econ_full 
 using "figures\TableA5 - one econ issue.rtf", replace 
		b (%10.3f) se scalars("aic AIC" "bic BIC" "rmse Root Mean Squared Error" "ll Log-Likelihood" ) 
		obslast star(+ 0.10 * 0.05 ** 0.01 *** 0.001)
		label mtitles ( "Opposition" "Incumbents" "Full") nogaps
		title (\label{})
order(ensh_1econ
1.inc_cab_l#c.ensh_1econ

moderate 
1.inc_cab_l#c.moderate
GDPgrowth
1.inc_cab_l#c.GDPgrowth 
1.inc_cab_l 
 majelect pvote_l _cons ) 

keep(ensh_1econ 1.inc_cab_l 
1.inc_cab_l#c.ensh_1econ GDPgrowth 
1.inc_cab_l#c.GDPgrowth 
1.inc_cab_l#c.moderate
moderate majelect 
pvote_l 
 _cons ) 

 coeflabels(
ensh_1econ "ENMI with 1 Econ Issue" 
1.inc_cab_l "Incumbent"
1.inc_cab_l#c.ensh_1econ "Incumbent X ENMI"
GDPgrowth "GDP Growth Rate" 
1.inc_cab_l#c.GDPgrowth "Incumbent X GDP Growth Rate"
1.inc_cab_l#c.moderate "Incumbent X Moderated Position"
moderate "Moderated Position"
majelect "Majoritarian Election"
pvote_l "% Vote{\sub t-1}"
_cons "Constant")
addnotes("Note: The Dependent variable is percentage vote for the party.");
 
